package com.danbay.cloud.common.api.service;

import com.danbay.cloud.common.api.dto.CodeValidateDto;
import com.danbay.cloud.common.api.dto.sms.DoorTempPwdDto;
import com.danbay.cloud.common.api.dto.sms.EmployeeRegNoticeDto;
import com.danbay.cloud.common.api.dto.sms.TenantMobileChangeDto;
import com.danbay.cloud.common.api.dto.sms.TenantPwdDto;
import com.danbay.framework.exception.BusinessException;
import com.danbay.framework.springnc.annotation.AutoController;
import com.danbay.framework.springnc.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author SJG
 *         2017/12/26.
 */
@AutoController
@RequestMapping("/common-service/sms")
public interface ISmsService {

    /**
     * 发送验证码短信
     *
     * @param mobile    手机号码
     * @param checkCode 验证码
     * @param expire    过期时间(秒)
     * @return 验证码id
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送验证码短信")
    @RequestMapping(value = "/sendCheckCode", method = RequestMethod.POST)
    String sendCheckCode(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                         @ApiParam("验证码") @RequestParam("checkCode") String checkCode,
                         @RequestParam("expire") @ApiParam("过期时间(秒)") Integer expire
    ) throws BusinessException;

    /**
     * 发送找回密码验证码短信
     *
     * @param mobile    手机号码
     * @param checkCode 验证码
     * @param expire    过期时间(秒)
     * @return 验证码id
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送找回密码验证码短信", notes = "找回密码时使用")
    @RequestMapping(value = "/sendFindPwdCheckCode", method = RequestMethod.POST)
    String sendFindPwdCheckCode(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                                @ApiParam("验证码") @RequestParam("checkCode") String checkCode,
                                @RequestParam("expire") @ApiParam("过期时间(秒)") Integer expire
    ) throws BusinessException;

    /**
     * 发送租客临时密码短信
     *
     * @param mobile    手机号码
     * @param tenantPwd 租客密码
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送租客临时密码短信")
    @RequestMapping(value = "/sendTenantTempPwd", method = RequestMethod.POST)
    void sendTenantTempPwd(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                           @ApiParam("租客密码") @RequestBody TenantPwdDto tenantPwd
    ) throws BusinessException;

    /**
     * 发送租客密码短信
     *
     * @param mobile    手机号码
     * @param tenantPwd 租客密码
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送租客密码短信")
    @RequestMapping(value = "/sendTenantPwd", method = RequestMethod.POST)
    void sendTenantPwd(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                       @ApiParam("租客密码") @RequestBody TenantPwdDto tenantPwd
    ) throws BusinessException;

    /**
     * 发送租客手机号变更通知短信
     *
     * @param tenantMobileChange 租客手机号变更通知
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送租客手机号变更通知短信")
    @RequestMapping(value = "/sendTenantMobileChange", method = RequestMethod.POST)
    void sendTenantMobileChange(@ApiParam("租客手机号变更通知") @RequestBody TenantMobileChangeDto tenantMobileChange) throws BusinessException;

    /**
     * 发送门锁临时密码短信
     *
     * @param mobile      手机号码
     * @param doorTempPwd 门锁临时密码
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送门锁临时密码短信")
    @RequestMapping(value = "/sendDoorTempPwd", method = RequestMethod.POST)
    void sendDoorTempPwd(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                         @ApiParam("租客手机号变更通知") @RequestBody DoorTempPwdDto doorTempPwd
    ) throws BusinessException;

    /**
     * 发员工注册通知短信
     *
     * @param employeeRegNotice 员工注册通知
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发员工注册通知短信")
    @RequestMapping(value = "/sendEmployeeRegNotice", method = RequestMethod.POST)
    void sendEmployeeRegNotice(@ApiParam("员工注册通知") @RequestBody EmployeeRegNoticeDto employeeRegNotice) throws BusinessException;

    /**
     * 发绑定账户通知短信
     *
     * @param employeeRegNotice 绑定账户通知
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发绑定账户通知短信")
    @RequestMapping(value = "/sendBindAccountNotice", method = RequestMethod.POST)
    void sendBindAccountNotice(@ApiParam("绑定账户通知") @RequestBody EmployeeRegNoticeDto employeeRegNotice
    ) throws BusinessException;

    /**
     * 发账号变更通知短信
     *
     * @param employeeRegNotice 账号变更通知
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发账号变更通知短信")
    @RequestMapping(value = "/sendAccountChangeNotice", method = RequestMethod.POST)
    void sendAccountChangeNotice(@ApiParam("账号变更通知") @RequestBody EmployeeRegNoticeDto employeeRegNotice
    ) throws BusinessException;

    /**
     * 发注册通知短信
     *
     * @param employeeRegNotice 注册通知
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发注册通知短信")
    @RequestMapping(value = "/sendRegisterNotice", method = RequestMethod.POST)
    void sendRegisterNotice(@ApiParam("注册通知") @RequestBody EmployeeRegNoticeDto employeeRegNotice
    ) throws BusinessException;

    /**
     * 验证短信验证码
     *
     * @param codeValidate 待验证的验证码信息
     * @return 是否正确
     */
    @ApiOperation(value = "验证短信验证码")
    @RequestMapping(value = "/validate", method = RequestMethod.POST)
    boolean validate( @RequestBody CodeValidateDto codeValidate) throws BusinessException;

    /**
     * 发送门锁密码短信
     *
     * @param mobile  手机号码
     * @param pwd     密码
     * @param begin   有效期开始时间
     * @param end     有效期结束时间
     * @param pwdName 密码名
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "发送门锁密码短信")
    @RequestMapping(value = "/sendDoorPwd", method = RequestMethod.POST)
    void sendDoorPwd(@ApiParam("手机号") @RequestParam("mobile") String mobile,
                     @ApiParam("密码") @RequestParam("pwd") String pwd,
                     @ApiParam("有效期开始时间") @RequestParam("begin") String begin,
                     @ApiParam("有效期结束时间") @RequestParam("end") String end,
                     @ApiParam("密码名") @RequestParam("pwdName") String pwdName) throws BusinessException;
}
